package com.game.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.game.common.annotation.DataScope;
import com.game.common.utils.DateUtils;
import com.game.system.domain.game.GameLog;
import com.game.system.mapper.GameLogMapper;
import com.game.system.service.IGameLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 游戏日志Service业务层处理
 *
 * @author Mr.Liu
 * @date 2025-04-10
 */
@Service
public class GameLogServiceImpl extends ServiceImpl<GameLogMapper, GameLog> implements IGameLogService {
    @Autowired
    private GameLogMapper gameLogMapper;

    /**
     * 查询游戏日志
     *
     * @param id 游戏日志主键
     * @return 游戏日志
     */
    @Override
    public GameLog selectGameLogById(Long id) {
        return gameLogMapper.selectGameLogById(id);
    }

    /**
     * 查询游戏日志列表
     *
     * @param gameLog 游戏日志
     * @return 游戏日志
     */
    @Override
    @DataScope(userAlias = "ga")
    public List<GameLog> selectGameLogList(GameLog gameLog) {
        return gameLogMapper.selectGameLogList(gameLog);
    }

    /**
     * 新增游戏日志
     *
     * @param gameLog 游戏日志
     * @return 结果
     */
    @Override
    public int insertGameLog(GameLog gameLog) {
        gameLog.setCreateTime(DateUtils.getNowDate());
        return gameLogMapper.insertGameLog(gameLog);
    }

    /**
     * 修改游戏日志
     *
     * @param gameLog 游戏日志
     * @return 结果
     */
    @Override
    public int updateGameLog(GameLog gameLog) {
        gameLog.setUpdateTime(DateUtils.getNowDate());
        return gameLogMapper.updateGameLog(gameLog);
    }

    /**
     * 批量删除游戏日志
     *
     * @param ids 需要删除的游戏日志主键
     * @return 结果
     */
    @Override
    public int deleteGameLogByIds(Long[] ids) {
        return gameLogMapper.deleteGameLogByIds(ids);
    }

    /**
     * 删除游戏日志信息
     *
     * @param id 游戏日志主键
     * @return 结果
     */
    @Override
    public int deleteGameLogById(Long id) {
        return gameLogMapper.deleteGameLogById(id);
    }
}
